<?php

$replace = array();
$replace["15"] = '/prikladnoe-programmirovanie/igra-pyatnashki-ishodniki-delphi';
$replace["bde"] = '/prikladnoe-programmirovanie/bez-ustanovki-bde';
$replace["contacts"] = '/kontakti/contacts';
$replace["delfolder"] = '/web-programmirovanie/udalit-ne-pustoy-katalog-php';
$replace["filter"] = '/prikladnoe-programmirovanie/filtratsiya-dannih-delfi-delphi';
$replace["goodprogr"] = '/soft-dlya-programmista/soft-prikladnoe-programmirovanie';
$replace["input_and_jquery"] = '/web-programmirovanie/jquery-vibrat-znacheniya-radio-boksov';
$replace["myprogr"] = '/moi-programmi/telefonniy-spravochnik-chernigovskoy-oblasti';
$replace["pixel"] = '/soft-dlya-programmista/uznat-tsvet-na-ekrane';
$replace["range"] = '/web-programmirovanie/sluchaynie-chisla-bez-povtoreniy-php';
$replace["real_ip"] = '/web-programmirovanie/realIip';
$replace["statist"] = '/web-programmirovanie/prikruchivaem-statistiku-k-saytu';
$replace["zend_000webhost_htaccess"] = '/web-programmirovanie/ustanovka-zf-na-hosting';

if (isset($_GET['action'])) {
    $action = trim($_GET['action']);
    if (key_exists($action, $replace)) {
        header("HTTP/1.1 301 Moved Permanently");
        header("Location: " . $replace[$action]);
    } else {
        @error_log( "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."\n", 3, '../logs/redirect-301.log');
        header("HTTP/1.1 301 Moved Permanently");
        header("Location: /arhive.php?action=".$action );
    }
}
header('Content-type: text/html; charset=utf-8');
require_once 'functionsEx.php';
//define('DEVEL_MODE', 1);
// Define path to application directory
defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
//_debug(APPLICATION_PATH,1);
// Define application environment
defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
            realpath(APPLICATION_PATH . '/../library'),
            get_include_path(),
        )));

/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
                APPLICATION_ENV,
                APPLICATION_PATH . '/configs/application.ini'
);
//_debug($application);
$application->bootstrap();

$application->run();